//
//  trainingViewController.h
//
//  Created by Eric van Riet Paap on 13-09-08.
//  Copyright __MyCompanyName__ 2008. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "MyCLController.h"
#import "Training.h"
#import "SoundEngine.h"



@interface trainingViewController : UIViewController <MyCLControllerDelegate>
{
	UIView				*myView;
	UIImageView			*background;
	UINavigationBar		*navbar;
	UIView				*content;
	UIWebView			*training_result;
	UIWebView			*training_schedule;
	UIButton			*tapedeck_left;
	UIButton			*tapedeck_play;
	UIButton			*tapedeck_right;
	UILabel				*distance;
	UIButton			*maps;
	UILabel				*training_phase;
	
	UILabel				*hold_progress_done;
	UIProgressView		*hold_progress;
	UILabel				*hold_progress_todo;
	
	UILabel				*progress_done;
	UIProgressView		*progress;
	UILabel				*progress_todo;
	
	BOOL				playing;
	NSTimer				*timer;
	
	float				currentLatitude, currentLongitude, currentAccuracy;
	
	int					reference_static_time;
	Training			*training;
	NSMutableArray		*trainingGpsResults;
	float				trainingGpsResultsDistance;
	NSDate				*startTime, *endTime, *pauseTime;
	Hold				*currentHold;
	
	sqlite3				*database;
}

-(void)setDatabase:(sqlite3*)_database;

-(IBAction)mapsUpAction:(id)sender;
-(IBAction)infoUpAction:(id)sender;
-(IBAction)leftUpAction:(id)sender;
-(IBAction)playPauseUpAction:(id)sender;
-(IBAction)rightUpAction:(id)sender;

-(void)updateDistanceText;
-(void)updateTrainingPhaseTextWithHold:(BOOL)holding;
-(void)updateProgressViews;
-(void)updateDatabaseWithCurrentTraining;

-(void)PlayWithSoundID:(SystemSoundID)soundID;
-(void)Vibrate;
-(void)Vibrate2;
-(void)Vibrate3;

@property (nonatomic, retain) UIView			*myView;
@property (nonatomic, retain) UIImageView		*background;
@property (nonatomic, retain) UINavigationBar	*navbar;
@property (nonatomic, retain) UIView			*content;
@property (nonatomic, retain) UIWebView			*training_result;
@property (nonatomic, retain) UIWebView			*training_schedule;
@property (nonatomic, retain) UIButton			*tapedeck_left;
@property (nonatomic, retain) UIButton			*tapedeck_play;
@property (nonatomic, retain) UIButton			*tapedeck_right;
@property (nonatomic, retain) UILabel			*distance;
@property (nonatomic, retain) UIButton			*maps;
@property (nonatomic, retain) UILabel			*training_phase, *hold_progress_done, *hold_progress_todo, *progress_done, *progress_todo;
@property (nonatomic, retain) UIProgressView	*hold_progress, *progress;
@property (nonatomic, retain) NSTimer			*timer;

@end
